unit Unit2;

{$mode Delphi}

interface

uses
  Classes,fphttpclient, SysUtils;


implementation

procedure THttpRequestThread.Create(Const Url: String);
begin
  Self.Url:=Url;
end;

procedure THttpRequestThread.Execute;
begin
     HTTPClient := TFPHTTPClient.Create(nil);
     try
       HTTPClient.ConnectTimeout := 1000;
       Response := HTTPClient.Get(Url);
       Memo1.Lines.Add('['+FormatDateTime('yyyy-mm-dd hh:nn:ss', Now)+'] '+' 请求成功: ' + Response);
     except
       on E: Exception do
        begin
          Memo1.Lines.Add('['+FormatDateTime('yyyy-mm-dd hh:nn:ss', Now)+'] '+' 请求失败: ' + E.Message);
          Timer1.Enabled := True;
        end;
     end;
     HTTPClient.Free;
end;

end.

